﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CompanyCMS.App_Code;

namespace CompanyCMS.Admin
{
    public partial class usermanage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        void Bind()
        {
            gvUser.DataSource = CommonBLL.GetUers();
            gvUser.DataKeyNames =new string[]{ "AdminId"};
            gvUser.DataBind();
        }

        protected void btn_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/admin/edituser.aspx");
        }

        protected void gvUser_RowDeleted(object sender, GridViewDeletedEventArgs e)
        {

        }

        protected void gvUser_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            CommonBLL.DeleteUser(gvUser.DataKeys[e.RowIndex].Value.ToString());
            Bind();
        }
    }
}